using Agron.Data.Contracts;
using Agron.Services.Contracts;

using System;
using System.ServiceModel;


namespace Agron.Services.Proxies
{
    /// <summary>
    /// Provides a <see cref="ClientBase{IMembershipService}"/> implementation for the <see cref="IMembershipService"/> service contract.
    /// </summary>
    public class MembershipServiceProxy : ClientBase<IMembershipService>, IMembershipService
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="MembershipServiceProxy"/> class.
        /// </summary>
        public MembershipServiceProxy() { }

        #region IMembershipService Members

        /// <summary>
        /// Verifies that the supplied user name and password are valid.
        /// </summary>
        /// <param name="username">The name of the user to be validated.</param>
        /// <param name="password">The password for the specified user.</param>
        /// <returns>
        /// true if the supplied user name and password are valid; otherwise, false.
        /// </returns>
        public bool ValidateUser(string username, string password)
        {
            return base.Channel.ValidateUser(username, password);
        }

        /// <summary>
        /// Gets the information from the data source for the specified membership user.
        /// </summary>
        /// <param name="username">The name of the user to be validated.</param>
        /// <returns>
        /// A <see cref="UserProfile"/> object representing the user.
        /// </returns>
        public UserProfile GetUserProfileByUserName(string username)
        {
            return base.Channel.GetUserProfileByUserName(username);
        }

        /// <summary>
        /// Gets the information from the data source for the specified membership user using a database identifier.
        /// </summary>
        /// <param name="userId"></param>
        /// <returns>
        /// A <see cref="UserProfile"/> object representing the user.
        /// </returns>
        public UserProfile GetUserProfileByUserId(Guid userId)
        {
            return base.Channel.GetUserProfileByUserId(userId);
        }

        /// <summary>
        /// Updates the database with the information for the specified user.
        /// </summary>
        /// <param name="userProfile">A <see cref="UserProfile"/> object that represents the user to be updated and the updated information for the user.</param>
        /// <exception cref="ArgumentNullException"><paramref name="userProfile"/> is null.</exception>
        public void UpdateUserProfile(UserProfile userProfile)
        {
            base.Channel.UpdateUserProfile(userProfile);
        }

        #endregion
    }
}
